home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / adir2cnc.zip / ADI2CNC.LST < prev    next >
File List  |  1990-11-29  |  37KB  |  696 lines

  1.  Thu 11-29-90 15:07:22    i       CONTENTS
  2.                                Page   Line
  3.  
  4. 11-27-90 12:24:02
  5. adi2cnc.bas                       1      1
  6. adi2cnc.bas                       9    494
  7.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   1
  8. Thu 11-29-90 15:07:22                                                                                                         of   9
  9.                                                                                                                                 1-55
  10.  
  11.     1             ' quick basic program to convert apple plotter commands
  12.     2             ' from autocad adi plotter file into G codes for use with
  13.     3             ' CNC milling machine
  14.     4             '
  15.     5             ' written by george mcduffee at allen county community college
  16.     6             ' march 13th, 1990
  17.     7             ' and released to the public domain.
  18.     8             '
  19.     9             ' program recognizes the following however other ADI commands can be added
  20.    10             ' if required.
  21.    11             '
  22.    12             ' 2 = home
  23.    13             ' G90
  24.    14             ' G00/000/000/000
  25.    15             '
  26.    16             ' 3 = move absolute [pen up]
  27.    17             ' G91
  28.    18             ' G01 000/000/0010
  29.    19             ' G90
  30.    20             ' G00 X/Y/Z
  31.    21             ' G91
  32.    22             ' G00 000/000/-010
  33.    23             '
  34.    24             ' 4 = plot absolute [pen down]
  35.    25             ' G91 X/Y/Z
  36.    26             '
  37.    27             ' exact conversion values will depend on how adi plotter selection
  38.    28             ' is set up.  This program assumes 254 points to the inch horz and vert.
  39.    29             '
  40.    30             ' Plot limits assumed to be within CNC limits - 7.87 in [200 m/m] X
  41.    31             ' 3.94 in [100 m/m] for Emco F1-CNC machine.
  42.    32             '
  43.    33             ' -------- start of program -------------
  44.    34
  45.    35             OPTION BASE 1d                  OPTION BASE  
  46.    36
  47.    37             DEFINT A-Zd                  DEFINT    
  48.    38
  49.    39             CLSd                  CLS
  50.    40             LOCATE 10, 10d                  LOCATE       
  51.    41             PRINT "This program will convert a AutoCadd ADI plotter output file"d                  PRINT                                                               
  52.    42             LOCATE 11, 10d                  LOCATE       
  53.    43             PRINT "into CNC G codes.  It assumes plot done at 1[inch] = 1[inch] and"d                  PRINT                                                                   
  54.    44             LOCATE 12, 10d                  LOCATE       
  55.    45             PRINT "plot size limited to 7.87 inches in the X direction and 3.94 inches"d                  PRINT                                                                      
  56.    46             LOCATE 13, 10d                  LOCATE       
  57.    47             PRINT "in the Y direction and that only ADI commands 2/3/4 [home/move abs/"d                  PRINT                                                                      
  58.    48             LOCATE 14, 10d                  LOCATE       
  59.    49             PRINT "plot abs are used.  Output will be written to <INFILE>.CNC"d                  PRINT                                                             
  60.    50             LOCATE 16, 10d                  LOCATE       
  61.    51             INPUT "input name of plot file"; plotfile$d                  INPUT                                     
  62.    52
  63.    53             ' ---------------- OPEN FILES --------------------------
  64.    54             plotfile$ = LTRIM$(RTRIM$(plotfile$))d                              LTRIM$ RTRIM$            
  65.    55
  66.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   2
  67. Thu 11-29-90 15:07:22                                                                                                         of   9
  68.                                                                                                                               56-110
  69.  
  70.    56             temp = INSTR(plotfile$, ".")d                         INSTR                
  71.    57
  72.    58          +--IF (temp = 0) THENd                  IF            THEN
  73.    59          |       plotfile$ = plotfile$ + ".plt"
  74.    60          +--END IFd                  END IF
  75.    61
  76.    62             OPEN plotfile$ FOR INPUT ACCESS READ AS #1 LEN = 16284d                  OPEN           FOR INPUT ACCESS READ AS    LEN        
  77.    63
  78.    64             temp = INSTR(plotfile$, ".")d                         INSTR                
  79.    65
  80.    66          +--IF temp = 0 THENd                  IF          THEN
  81.    67          |       gcodefile$ = plotfile$ + ".cnc"
  82.    68          +--ELSEd                  ELSE
  83.    69          |       gcodefile$ = LEFT$(plotfile$, (temp - 1))d                                    LEFT$                       
  84.    70          |       gcodefile$ = gcodefile$ + ".cnc"
  85.    71          +--END IFd                  END IF
  86.    72
  87.    73             OPEN gcodefile$ FOR OUTPUT ACCESS WRITE AS #2 LEN = 16284d                  OPEN            FOR OUTPUT ACCESS WRITE AS    LEN        
  88.    74
  89.    75
  90.    76             ' ----------------- DIM VARIABLES -----------------------
  91.    77             DIM comma(4) AS INTEGERd                  DIM          AS INTEGER
  92.    78             DIM InLineCounter AS INTEGERd                  DIM               AS INTEGER
  93.    79
  94.    80             ' Emco F1 omits decimal point
  95.    81             ' i.e. "0050" is  0.050
  96.    82             CONST clearence = "   150"d                  CONST                     
  97.    83
  98.    84             ' feed is in 1/10 inches per min.
  99.    85             ' i.e. "020" = 2 inches per min.
  100.    86             CONST Feed = "  20"d                  CONST              
  101.    87
  102.    88             ' factor to convert ADI values to CNC values
  103.    89             ' in this case 0.1 M/M to .001 inches
  104.    90             CONST ConversionFactor# = .254d                  CONST                         
  105.    91
  106.    92             ' emco F1-CNC controller requires information in specific column format
  107.    93
  108.    94             DIM HeaderLine1 AS STRING * 4d                  DIM             AS STRING    
  109.    95             HeaderLine1 = CHR$(255) + CHR$(255) + CHR$(255) + "%"d                                CHR$        CHR$        CHR$           
  110.    96
  111.    97             DIM HeaderLine2 AS STRING * 30d                  DIM             AS STRING     
  112.    98             HeaderLine2 = "    N` G`  X  `  Y `   Z ` F  "
  113.    99
  114.   100             DIM LastLine AS STRINGd                  DIM          AS STRING
  115.   101             LastLine = "  " + CHR$(34) + "I":  'this is >   "I< indicating inch Verticald                                    CHR$                                                      
  116.   102             LastLine = LastLine + CHR$(16) + CHR$(16) + CHR$(16) + CHR$(16) + CHR$(16)d                                        CHR$       CHR$       CHR$       CHR$       CHR$    
  117.   103             LastLine = LastLine + CHR$(16) + CHR$(16) + CHR$(16) + CHR$(16) + CHR$(16)d                                        CHR$       CHR$       CHR$       CHR$       CHR$    
  118.   104
  119.   105             CONST FeedRate = "  10"d                  CONST                  
  120.   106
  121.   107             TYPE EmcoLined                  TYPE         
  122.   108             filler AS STRING * 3d                         AS STRING    
  123.   109             BlockNo AS STRING * 3d                          AS STRING    
  124.   110             Gcode AS STRING * 3d                        AS STRING    
  125.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   3
  126. Thu 11-29-90 15:07:22                                                                                                         of   9
  127.                                                                                                                              111-165
  128.  
  129.   111             CNCx AS STRING * 6d                       AS STRING    
  130.   112             CNCy AS STRING * 5d                       AS STRING    
  131.   113             CNCz AS STRING * 6d                       AS STRING    
  132.   114             Feed AS STRING * 4d                       AS STRING    
  133.   115             END TYPEd                  END TYPE
  134.   116
  135.   117             DIM emco AS EmcoLined                  DIM      AS         
  136.   118             emco.filler = "   "
  137.   119             emco.BlockNo = "000"
  138.   120             emco.Gcode = " 21"
  139.   121             emco.CNCx = "    00"
  140.   122             emco.CNCy = "   00"
  141.   123             emco.CNCz = "    00"
  142.   124             emco.Feed = "    "
  143.   125
  144.   126
  145.   127             DIM blankemco AS EmcoLined                  DIM           AS         
  146.   128             blankemco.filler = "   "
  147.   129             blankemco.Gcode = "   "
  148.   130             blankemco.CNCx = "      "
  149.   131             blankemco.CNCy = "     "
  150.   132             blankemco.CNCz = "      "
  151.   133             blankemco.Feed = "    "
  152.   134
  153.   135             emco = blankemco
  154.   136
  155.   137             DIM OldCNCx AS STRING * 6d                  DIM         AS STRING    
  156.   138             OldCNCx = "    00"
  157.   139
  158.   140             DIM OldCNCy AS STRING * 5d                  DIM         AS STRING    
  159.   141             OldCNCy = "   00"
  160.   142
  161.   143             DIM OldCNCz AS STRING * 6d                  DIM         AS STRING    
  162.   144             OldCNCz = "    00"
  163.   145
  164.   146             DIM blank6 AS STRING * 6d                  DIM        AS STRING    
  165.   147             blank6 = "      "
  166.   148             DIM blank5 AS STRING * 5d                  DIM        AS STRING    
  167.   149             blank5 = "     "
  168.   150             DIM blank4 AS STRING * 4d                  DIM        AS STRING    
  169.   151             blank4 = "    "
  170.   152             DIM blank3 AS STRING * 3d                  DIM        AS STRING    
  171.   153             blank3 = "   "
  172.   154
  173.   155             DIM tempd AS DOUBLEd                  DIM       AS DOUBLE
  174.   156
  175.   157             DIM pc, px, py AS DOUBLEd                  DIM            AS DOUBLE
  176.   158
  177.   159             TYPE emcostringd                  TYPE           
  178.   160             es1 AS STRING * 30d                      AS STRING     
  179.   161             END TYPEd                  END TYPE
  180.   162
  181.   163             DIM es AS emcostringd                  DIM    AS           
  182.   164
  183.   165
  184.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   4
  185. Thu 11-29-90 15:07:22                                                                                                         of   9
  186.                                                                                                                              166-220
  187.  
  188.   166             ' ----------------- START OF MAIN -----------------------
  189.   167
  190.   168             ' send header lines to cnc file
  191.   169             PRINT #2, HeaderLine1d                  PRINT                
  192.   170             PRINT #2, HeaderLine2d                  PRINT                
  193.   171
  194.   172
  195.   173             linecount = -1
  196.   174
  197.   175             ' set cnc to absolute mode
  198.   176
  199.   177             emco = blankemco
  200.   178
  201.   179             GOSUB MakeNstringd                  GOSUB            
  202.   180
  203.   181             emco.BlockNo = Nstring$
  204.   182             emco.Gcode = " 90"
  205.   183             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  206.   184
  207.   185
  208.   186          +--WHILE NOT (EOF(1))d                  WHILE NOT  EOF    
  209.   187          |       LINE INPUT #1, PlotterLine$d                       LINE INPUT                 
  210.   188          |
  211.   189          |       ' for debug
  212.   190          |       ' PRINT PlotterLine$
  213.   191          |
  214.   192          |       GOSUB Convert2CNCd                       GOSUB            
  215.   193          +--WENDd                  WEND
  216.   194
  217.   195             ' write M30 as last line of cnc file
  218.   196
  219.   197             GOSUB MakeNstringd                  GOSUB            
  220.   198             emco = blankemco
  221.   199             emco.BlockNo = Nstring$
  222.   200             emco.Gcode = "M30":  'rapid traverse
  223.   201             emco.CNCx = "      "
  224.   202             emco.CNCy = "     "
  225.   203             emco.CNCz = "      "
  226.   204             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  227.   205
  228.   206             ' add lst line
  229.   207             PRINT #2, LastLined                  PRINT             
  230.   208             ' PRINT #2, ""
  231.   209
  232.   210
  233.   211             CLOSEd                  CLOSE
  234.   212
  235.   213             ' display warning if block count greater than F1-CNC limits
  236.   214          +--IF linecount > 221 THENd                  IF                 THEN
  237.   215          |       CLSd                       CLS
  238.   216          |       LOCATE 10, 10d                       LOCATE       
  239.   217          |       PRINT "WARNING"d                       PRINT          
  240.   218          |       LOCATE 12, 10d                       LOCATE       
  241.   219          |       PRINT "Generated program contains "; linecount; " blocks"d                       PRINT                                                    
  242.   220          |       LOCATE 14, 10d                       LOCATE       
  243.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   5
  244. Thu 11-29-90 15:07:22                                                                                                         of   9
  245.                                                                                                                              221-275
  246.  
  247.   221          |       PRINT "The limit of the EMCO controller is 221."d                       PRINT                                           
  248.   222          |       LOCATE 16, 10d                       LOCATE       
  249.   223          |       PRINT "DATA is usable -- edit and run as two programs"d                       PRINT                                                 
  250.   224          +--END IFd                  END IF
  251.   225
  252.   226
  253.   227             ENDd                  END
  254.   228
  255.   229             ' -------------------- END OF MAIN -----------------------
  256.   230
  257.   231             ' -----------
  258.   232 Convert2CNC:
  259.   233
  260.   234
  261.   235             ' set px and py [plotter x and plotter y to -1
  262.   236             ' if -1 shows these were not set and error if not 'home'
  263.   237             pc = -1
  264.   238             px = -1
  265.   239             py = -1
  266.   240
  267.   241             ' parse plotter line and check data format
  268.   242             'count the number of commas in plotter line assume 2 max but check for
  269.   243             ' three for error condition
  270.   244             comma(1) = 0
  271.   245             comma(2) = 0
  272.   246             comma(3) = 0
  273.   247
  274.   248             'increment plotter input file line counter for error reporting
  275.   249             InLineCounter = InLineCounter + 1
  276.   250
  277.   251             comma(1) = INSTR(PlotterLine$, ",")d                             INSTR                   
  278.   252
  279.   253          +--IF comma(1) > 0 THENd                  IF              THEN
  280.   254          |       comma(2) = INSTR(comma(1) + 1, PlotterLine$, ",")d                                  INSTR                                 
  281.   255          +--END IFd                  END IF
  282.   256
  283.   257          +--IF comma(2) > 0 THENd                  IF              THEN
  284.   258          |       comma(3) = INSTR(comma(2) + 1, PlotterLine$, ",")d                                  INSTR                                 
  285.   259          +--END IFd                  END IF
  286.   260
  287.   261             ' for debug
  288.   262             ' PRINT "In Line = "; InLineCounter
  289.   263             ' PRINT "comma(1) = "; comma(1)
  290.   264             ' PRINT "comma(2) = "; comma(2)
  291.   265             ' PRINT "comma(3) = "; comma(3)
  292.   266
  293.   267          +--IF comma(3) > 0 THENd                  IF              THEN
  294.   268          |       CLSd                       CLS
  295.   269          |       LOCATE 5, 10d                       LOCATE      
  296.   270          |       PRINT "error condition in input file at line "; InLineCounterd                       PRINT                                                        
  297.   271          |       LOCATE 7, 10d                       LOCATE      
  298.   272          |       PRINT "More than 2 commas found. "d                       PRINT                             
  299.   273          |       LOCATE 9, 10d                       LOCATE      
  300.   274          |       PRINT "correct input [plotter] file and rerun.  Press [Enter] key to exit."d                       PRINT                                                                      
  301.   275          |       INPUT ; "", dummy$d                       INPUT             
  302.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   6
  303. Thu 11-29-90 15:07:22                                                                                                         of   9
  304.                                                                                                                              276-330
  305.  
  306.   276          |       ENDd                       END
  307.   277          +--END IFd                  END IF
  308.   278
  309.   279          +--IF comma(1) = 0 THENd                  IF              THEN
  310.   280          |       pc = VAL(PlotterLine$)d                            VAL              
  311.   281          +--ELSEd                  ELSE
  312.   282          |    +--IF comma(2) = 0 THENd                       IF              THEN
  313.   283          |    |       'error as line must have no or two commas
  314.   284          |    |       CLSd                            CLS
  315.   285          |    |       LOCATE 5, 10d                            LOCATE      
  316.   286          |    |       PRINT "error condition in input file at line "; InLineCounterd                            PRINT                                                        
  317.   287          |    |       LOCATE 7, 10d                            LOCATE      
  318.   288          |    |       PRINT "Only 1 comma found. Line must have no or two commas"d                            PRINT                                                      
  319.   289          |    |       LOCATE 9, 10d                            LOCATE      
  320.   290          |    |       PRINT "correct input [plotter] file and rerun.  Press [Enter] key to exit."d                            PRINT                                                                      
  321.   291          |    |       INPUT ; "", dummy$d                            INPUT             
  322.   292          |    |       ENDd                            END
  323.   293          |    +--END IFd                       END IF
  324.   294          |
  325.   295          |       pc = VAL(PlotterLine$)d                            VAL              
  326.   296          |       temp$ = MID$(PlotterLine$, comma(1) + 1, (comma(2) - comma(1) - 1))d                               MID$                                                       
  327.   297          |       px = VAL(temp$)d                            VAL       
  328.   298          |       temp$ = MID$(PlotterLine$, comma(2) + 1)d                               MID$                            
  329.   299          |       py = VAL(temp$)d                            VAL       
  330.   300          +--END IFd                  END IF
  331.   301
  332.   302             ' debug
  333.   303             ' PRINT "pc ="; pc
  334.   304             ' PRINT "px ="; px
  335.   305             ' PRINT "py ="; py
  336.   306
  337.   307             GOSUB WriteGCoded                  GOSUB           
  338.   308
  339.   309
  340.   310             RETURNd                  RETURN
  341.   311             ' -----------
  342.   312
  343.   313             ' -----------
  344.   314 WriteGCode:
  345.   315             ' px and py from plotter file are in .1 M/M
  346.   316
  347.   317             ' save existing CNC x/y/z  values for possible later use to withdraw cutter
  348.   318             ' without setting to relative mode and then back [saves blocks]
  349.   319          +--IF NOT emco.CNCx = "      " THENd                  IF NOT                      THEN
  350.   320          |       OldCNCx = emco.CNCx
  351.   321          +--END IFd                  END IF
  352.   322
  353.   323          +--IF NOT emco.CNCy = "     " THENd                  IF NOT                     THEN
  354.   324          |       OldCNCy = emco.CNCy
  355.   325          +--END IFd                  END IF
  356.   326
  357.   327          +--IF NOT emco.CNCz = "      " THENd                  IF NOT                      THEN
  358.   328          |       OldCNCz = emco.CNCz
  359.   329          +--END IFd                  END IF
  360.   330
  361.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   7
  362. Thu 11-29-90 15:07:22                                                                                                         of   9
  363.                                                                                                                              331-385
  364.  
  365.   331
  366.   332             ' move absolute pen up
  367.   333             IF (pc = 3) THEN GOSUB MoveCutterUpd                  IF          THEN GOSUB             
  368.   334
  369.   335             'move absolute pen down
  370.   336             IF pc = 4 THEN GOSUB MillLined                  IF        THEN GOSUB         
  371.   337
  372.   338             ' home
  373.   339             IF (pc = 2 AND px = -1 AND py = -1) THEN GOSUB Homed                  IF         AND         AND          THEN GOSUB     
  374.   340
  375.   341             RETURNd                  RETURN
  376.   342             ' --------------
  377.   343
  378.   344             ' -------------
  379.   345 MakeNstring:
  380.   346
  381.   347             linecount = linecount + 1
  382.   348
  383.   349             n$ = STR$(linecount)d                       STR$           
  384.   350             n$ = RTRIM$(LTRIM$(n$))d                       RTRIM$ LTRIM$     
  385.   351         ++--SELECT CASE LEN(n$)d                  SELECT CASE LEN    
  386.   352         |+-------CASE IS = 1d                       CASE IS    
  387.   353         ||            Nstring$ = "00" + n$
  388.   354         |+-------CASE IS = 2d                       CASE IS    
  389.   355         ||            Nstring$ = "0" + n$
  390.   356         |+-------CASE IS = 3d                       CASE IS    
  391.   357         ||            Nstring$ = n$
  392.   358         |+-------CASE ELSEd                       CASE ELSE
  393.   359         ++--END SELECTd                  END SELECT
  394.   360
  395.   361             RETURNd                  RETURN
  396.   362             ' ----------
  397.   363
  398.   364             ' ---------- homes the head
  399.   365   Home:
  400.   366
  401.   367             'withdraw cutter under rapid traverse
  402.   368             GOSUB MakeNstringd                  GOSUB            
  403.   369             emco = blankemco
  404.   370             emco.BlockNo = Nstring$
  405.   371             emco.Gcode = " 00":  'rapid traverse
  406.   372             emco.CNCx = OldCNCx
  407.   373             emco.CNCy = OldCNCy
  408.   374             emco.CNCz = "    00"
  409.   375             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  410.   376
  411.   377             ' move to home under rapid traverse
  412.   378             GOSUB MakeNstringd                  GOSUB            
  413.   379             emco = blankemco
  414.   380             emco.BlockNo = Nstring$
  415.   381             emco.Gcode = " 00":  'rapid traverse
  416.   382             emco.CNCx = "    00"
  417.   383             emco.CNCy = "   00"
  418.   384             emco.CNCz = "    00"
  419.   385             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  420.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   8
  421. Thu 11-29-90 15:07:22                                                                                                         of   9
  422.                                                                                                                              386-440
  423.  
  424.   386
  425.   387
  426.   388             RETURNd                  RETURN
  427.   389             ' -----------
  428.   390
  429.   391             ' ----------
  430.   392 MoveCutterUp:
  431.   393
  432.   394             ' withdraw cutter at rapid traverse
  433.   395             GOSUB MakeNstringd                  GOSUB            
  434.   396             emco = blankemco
  435.   397             emco.BlockNo = Nstring$
  436.   398             emco.Gcode = " 00":  'rapid traverse
  437.   399             emco.CNCx = OldCNCx
  438.   400             emco.CNCy = OldCNCy
  439.   401             emco.CNCz = "    00"
  440.   402             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  441.   403
  442.   404
  443.   405             ' move to new location at rapid traverse
  444.   406             GOSUB MakeNstringd                  GOSUB            
  445.   407             emco = blankemco
  446.   408             GOSUB ConvertP2Gd                  GOSUB           
  447.   409             emco.BlockNo = Nstring$
  448.   410             emco.Gcode = " 00":  'rapid traverse
  449.   411             emco.CNCz = "    00"
  450.   412             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  451.   413
  452.   414
  453.   415             ' bring cutter down at proper feed rate at new location
  454.   416             GOSUB MakeNstringd                  GOSUB            
  455.   417             emco.BlockNo = Nstring$
  456.   418             emco.Gcode = " 01":  'linear interpolation
  457.   419             emco.CNCz = clearence
  458.   420             emco.Feed = FeedRate
  459.   421             MID$(emco.CNCz, 1) = "-": '- to feed downd                  MID$                                     
  460.   422             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  461.   423
  462.   424
  463.   425
  464.   426
  465.   427             RETURNd                  RETURN
  466.   428             ' ----------
  467.   429
  468.   430             ' ----------
  469.   431 MillLine:
  470.   432             ' mill line
  471.   433             GOSUB MakeNstringd                  GOSUB            
  472.   434             emco = blankemco
  473.   435             GOSUB ConvertP2Gd                  GOSUB           
  474.   436             emco.CNCz = clearence
  475.   437             MID$(emco.CNCz, 1, 1) = "-"d                  MID$                       
  476.   438             emco.BlockNo = Nstring$
  477.   439             emco.Gcode = " 01":  'linear interp
  478.   440             emco.Feed = FeedRate
  479.     11-27-90 12:24:02  adi2cnc.bas                                                                                            Pg   9
  480. Thu 11-29-90 15:07:22                                                                                                         of   9
  481.                                                                                                                              441-494
  482.  
  483.   441             PRINT #2, emco.filler; emco.BlockNo; emco.Gcode; emco.CNCx; emco.CNCy; emco.CNCz; emco.Feedd                  PRINT                                                                                      
  484.   442
  485.   443
  486.   444
  487.   445             RETURNd                  RETURN
  488.   446             ' ----------
  489.   447
  490.   448 ConvertP2G:
  491.   449             ' converts adi plotter values to 1000's of inch for F1 controller
  492.   450
  493.   451             OldCNCx = emco.CNCx
  494.   452             OldCNCy = emco.CNCy
  495.   453
  496.   454
  497.   455             tempd = (px / ConversionFactor)
  498.   456             tempI = INT(tempd)d                          INT       
  499.   457             temp$ = ""
  500.   458             temp$ = STR$(tempI)d                          STR$       
  501.   459             temp$ = RTRIM$(LTRIM$(temp$))d                          RTRIM$ LTRIM$        
  502.   460         ++--SELECT CASE LEN(temp$)d                  SELECT CASE LEN       
  503.   461         |+-------CASE IS = 1d                       CASE IS    
  504.   462         ||            temp$ = "     " + temp$
  505.   463         |+-------CASE IS = 2d                       CASE IS    
  506.   464         ||            temp$ = "    " + temp$
  507.   465         |+-------CASE IS = 3d                       CASE IS    
  508.   466         ||            temp$ = "   " + temp$
  509.   467         |+-------CASE 4d                       CASE  
  510.   468         ||            temp$ = "  " + temp$
  511.   469         |+-------CASE ELSEd                       CASE ELSE
  512.   470         ||            temp$ = "~~~~~~"
  513.   471         ++--END SELECTd                  END SELECT
  514.   472             emco.CNCx = temp$
  515.   473
  516.   474             tempd = (py / ConversionFactor)
  517.   475             tempI = INT(tempd)d                          INT       
  518.   476             temp$ = ""
  519.   477             temp$ = STR$(tempI)d                          STR$       
  520.   478             temp$ = RTRIM$(LTRIM$(temp$))d                          RTRIM$ LTRIM$        
  521.   479         ++--SELECT CASE LEN(temp$)d                  SELECT CASE LEN       
  522.   480         |+-------CASE IS = 1d                       CASE IS    
  523.   481         ||            temp$ = "    " + temp$
  524.   482         |+-------CASE IS = 2d                       CASE IS    
  525.   483         ||            temp$ = "   " + temp$
  526.   484         |+-------CASE IS = 3d                       CASE IS    
  527.   485         ||            temp$ = "  " + temp$
  528.   486         |+-------CASE 4d                       CASE  
  529.   487         ||            temp$ = " " + temp$
  530.   488         |+-------CASE ELSEd                       CASE ELSE
  531.   489         ||            temp$ = "~~~~~"
  532.   490         ++--END SELECTd                  END SELECT
  533.   491             emco.CNCy = temp$
  534.   492
  535.   493             RETURNd                  RETURN
  536.   494
  537.  
  538. Thu 11-29-90 15:07:22   INDEX/Cross Reference
  539.  
  540. Format:   Page.Line
  541. Category: All identifiers
  542.  
  543.   1 11-27-90 12:24:02  adi2cnc.bas              
  544.  
  545.  
  546. #1          2=62      4=187  
  547.  
  548. #2          2.73      4.169     4.170     4.183     4.204     4.207     7.375     7.385     8.402     8.412     8.422     9.441  
  549.  
  550. .254        2.90   
  551.  
  552. blankemco             3.127     3.135     4.177     4.198     7.369     7.379     8.396     8.407     8.434  
  553.  
  554. blankemco.CNCx        3=130  
  555.  
  556. blankemco.CNCy        3=131  
  557.  
  558. blankemco.CNCz        3=132  
  559.  
  560. blankemco.Feed        3=133  
  561.  
  562. blankemco.filler      3=128  
  563.  
  564. blankemco.Gcode       3=129  
  565.  
  566. blank3      3.152     3=153  
  567.  
  568. blank4      3.150     3=151  
  569.  
  570. blank5      3.148     3=149  
  571.  
  572. blank6      3.146     3=147  
  573.  
  574. BlockNo     2.109  
  575.  
  576. clearence             2.82      8.419     8.436  
  577.  
  578. CNCx        3.111  
  579.  
  580. CNCy        3.112  
  581.  
  582. CNCz        3.113  
  583.  
  584. comma       2.77      5.244     5.245     5.246     5.251     5.253     5.254     5.257     5.258     5.267     6.279     6.282  
  585.             6.296     6.298  
  586.  
  587. ConversionFactor      9.455     9.474  
  588.  
  589. ConversionFactor#     2.90   
  590.  
  591. ConvertP2G           <9.448     8.408     8.435  
  592.  
  593. Convert2CNC          <5.232     4.192  
  594.  
  595. Thu 11-29-90 15:07:22   INDEX/Cross Reference
  596.  
  597. Format:   Page.Line
  598. Category: All identifiers
  599.  
  600.  
  601. dummy$      5=275     6=291  
  602.  
  603. emco        3.117     3=135     4=177     4=198     7=369     7=379     8=396     8=407     8=434  
  604.  
  605. emco.BlockNo          3=119     4=181     4.183     4=199     4.204     7=370     7.375     7=380     7.385     8=397     8.402  
  606.                       8=409     8.412     8=417     8.422     8=438     9.441  
  607.  
  608. emco.CNCx             3=121     4.183     4=201     4.204     6.319     6.320     7=372     7.375     7=382     7.385     8=399  
  609.                       8.402     8.412     8.422     9.441     9.451     9=472  
  610.  
  611. emco.CNCy             3=122     4.183     4=202     4.204     6.323     6.324     7=373     7.375     7=383     7.385     8=400  
  612.                       8.402     8.412     8.422     9.441     9.452     9=491  
  613.  
  614. emco.CNCz             3=123     4.183     4=203     4.204     6.327     6.328     7=374     7.375     7=384     7.385     8=401  
  615.                       8.402     8=411     8.412     8=419     8p421     8.422     8=436     8p437     9.441  
  616.  
  617. emco.Feed             3=124     4.183     4.204     7.375     7.385     8.402     8.412     8=420     8.422     8=440     9.441  
  618.  
  619. emco.filler           3=118     4.183     4.204     7.375     7.385     8.402     8.412     8.422     9.441  
  620.  
  621. emco.Gcode            3=120     4=182     4.183     4=200     4.204     7=371     7.375     7=381     7.385     8=398     8.402  
  622.                       8=410     8.412     8=418     8.422     8=439     9.441  
  623.  
  624. EmcoLine    2.107     3.117     3.127  
  625.  
  626. emcostring            3.159     3.163  
  627.  
  628. es          3.163  
  629.  
  630. es1         3.160  
  631.  
  632. Feed        2.86      3.114  
  633.  
  634. FeedRate    2.105     8.420     8.440  
  635.  
  636. filler      2.108  
  637.  
  638. Gcode       2.110  
  639.  
  640. gcodefile$            2=67      2=69      2=70      2.73   
  641.  
  642. HeaderLine1           2.94      2=95      4.169  
  643.  
  644. HeaderLine2           2.97      2=98      4.170  
  645.  
  646. Home       <7.365     7.339  
  647.  
  648. InLineCounter         2.78      5=249     5.270     6.286  
  649.  
  650. LastLine    2.100     2=101     2=102     2=103     4.207  
  651.  
  652. Thu 11-29-90 15:07:22   INDEX/Cross Reference
  653.  
  654. Format:   Page.Line
  655. Category: All identifiers
  656.  
  657.  
  658. linecount             4=173     4.214     4.219     7=347     7p349  
  659.  
  660. MakeNstring          <7.345     4.179     4.197     7.368     7.378     8.395     8.406     8.416     8.433  
  661.  
  662. MillLine   <8.431     7.336  
  663.  
  664. MoveCutterUp         <8.392     7.333  
  665.  
  666. n$          7=349     7=350     7p351     7.353     7.355     7.357  
  667.  
  668. Nstring$    4.181     4.199     7=353     7=355     7=357     7.370     7.380     8.397     8.409     8.417     8.438  
  669.  
  670. OldCNCx     3.137     3=138     6=320     7.372     8.399     9=451  
  671.  
  672. OldCNCy     3.140     3=141     6=324     7.373     8.400     9=452  
  673.  
  674. OldCNCz     3.143     3=144     6=328  
  675.  
  676. pc          3.157     5=237     6=280     6=295     7.333     7.336     7.339  
  677.  
  678. plotfile$             1=51      1=54      2p56      2=59      2.62      2p64      2.67      2p69   
  679.  
  680. PlotterLine$          4=187     5p251     5p254     5p258     6p280     6p295     6p296     6p298  
  681.  
  682. px          3.157     5=238     6=297     7.339     9.455  
  683.  
  684. py          3.157     5=239     6=299     7.339     9.474  
  685.  
  686. temp        2=56      2.58      2=64      2.66      2.69   
  687.  
  688. temp$       6=296     6p297     6=298     6p299     9=457     9=458     9=459     9p460     9=462     9=464     9=466     9=468  
  689.             9=470     9.472     9=476     9=477     9=478     9p479     9=481     9=483     9=485     9=487     9=489     9.491  
  690.  
  691. tempd       3.155     9=455     9p456     9=474     9p475  
  692.  
  693. tempI       9=456     9p458     9=475     9p477  
  694.  
  695. WriteGCode           <6.314     6.307  
  696.